package hysoft.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

@RestController
public class FileUploadController {
/**
 * 处理文件上传
 * http://localhost:8080/upload.html
 */

@RequestMapping("/fileUploadController")
public Map<String,Object> fileUpload(MultipartFile filename) throws IOException {
    System.out.println(filename.getOriginalFilename());
    filename.transferTo(new File("e:/"+filename.getOriginalFilename()));
    Map<String, Object> map = new HashMap<>();
    map.put("msg","ok");

    return map;
}
}
